package com.example.xViewChat.Util;

import android.widget.EditText;

import java.util.regex.Pattern;

/**
 * Created by hasee on 2016-04-06.
 */
public class VerifyUtils {
    public static boolean isNull(EditText editText) {
        String text = editText.getText().toString().trim();
        if (text != null && text.length() > 0) {
            return false;
        }
        return true;
    }

    public static boolean matchAccount(String text) {
        if (Pattern.compile("^[a-z0-9_-]{6,18}$").matcher(text).matches()) {
            return true;
        }
        return false;
    }

    public static boolean matchEmail(String text) {
        if (Pattern.compile("\\w[\\w.-]*@[\\w.]+\\.\\w+").matcher(text)
                .matches()) {
            return true;
        }
        return false;
    }
}
